﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
    public class DAL_HoaDon
    {
        Connect da = new Connect();
        public DataTable showhoadon()
        {
            string sql = "select * from HoaDon";
            DataTable dt = new DataTable();
            dt = da.GetTable(sql);
            return dt;
        }
        public void inserthoadon(string mhd, string thd, string nl, string mnv, string mkh)
        {
            string sql = "insert HoaDon values('" + mhd + "',N'" + thd + "','" + nl + "','" + mnv + "','" + mkh + "')";
            da.Excutenonquery(sql);

        }
        public void Updatehoadon(string mhd1, string mhd, string thd, string nl, string mnv)
        {
            string sql = "UPDATE HoaDon SET MaHD='" + mhd + "',TENHD=N'" + thd + "',NgayLap='" + nl + "',MaNV='" + mnv + "'where MaHD='" + mhd1 + "'";
            da.Excutenonquery(sql);

        }
        public void Deletehoadon(string mhd_d)
        {
            string sql = "DELETE HoaDon WHERE MaHD='" + mhd_d + "'";
            da.Excutenonquery(sql);

        }

    }
}
